package string;

public class TrimDemo {
    public static void main(String[] args) {
        String str = "      hello world         ";
        String trim = str.trim();//trim()后得到的字符串对象并存储在trim变量中
        System.out.println(trim);//hello world
        System.out.println(str);//    hello world   ,字符串是不变对象,str内容不变
    }
}
